package model.commands.controlflow;

import model.Environment;
import model.SyntaxErrorException;
import model.commands.Command;


/**
 * Syntax:
 * [ ]
 * 
 * Description:
 * these brackets enclose a list of zero or more commands or variables
 * returns return value of last command executed
 * 
 * @author JLongley
 * @author Erick Gonzalez
 */
public class ListCommand extends Command {

    @Override
    public int evaluate(Environment e) throws SyntaxErrorException {
        int returnValue = 0;
        for (Command command : getArguments()) {
            returnValue = command.evaluate(e);
        }
        return returnValue;
    }
}
